18. Null, Undefined, and NaN

Null, Undefined, and NaN

Difference between Null and Undefined

INSTRUCTOR NOTE:

`null` refers to the "value of nothing", while `undefined` refers to the "absence of value".

What is NaN?

NaN stands for "Not-A-Number" and it's often returned indicating an error with number operations. For instance, if you wrote some code that performed a math calculation, and the calculation failed to produce a valid number, NaN might be returned.

// calculating the square root of a negative number will return NaN
Math.sqrt(-10)

// trying to divide a string by 5 will return NaN
"hello"/5

What will be printed out?

What will be printed out?

var signedIn;
console.log(signedIn);
SOLUTION: undefined